package com.app.view.pulltorefresh;

import android.content.Context;
import android.support.annotation.Nullable;
import android.util.AttributeSet;
import android.widget.LinearLayout;

/**
 * Created by Administrator on 2016/11/24.
 */

public class PullableLinearLayout extends LinearLayout implements Pullable {


    public PullableLinearLayout(Context context) {
        super(context);
    }

    public PullableLinearLayout(Context context, @Nullable AttributeSet attrs) {
        super(context, attrs);
    }

    public PullableLinearLayout(Context context, @Nullable AttributeSet attrs, int defStyle) {
        super(context, attrs, defStyle);
    }

    @Override
    public boolean canPullDown() {
        if (!canScrollVertically(-1)) {
            // 滑到RecyclerView的顶部了
            return true;
        }
        return false;
    }


    @Override
    public boolean canPullUp() {
        if (!canScrollVertically(1)) {
            return true;
        }
        return false;
    }
}
